//https://www.nowcoder.com/practice/56ea71d1f4e94de2aaec10e985874cce?tpId=196&tqId=40269&ru=/exam/oj
#include <algorithm>
class Solution {
public:
    
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        std::sort(nums1.begin(), nums1.end());
        std::sort(nums2.begin(), nums2.end());

        std::vector<int> ret;
        int i = 0, j = 0;
        while (i < nums1.size() && j < nums2.size()) {
            if (nums1[i] == nums2[j]) {
                ret.push_back(nums1[i]);
                int x = nums1[i];
                while (i < nums1.size() && nums1[i] == x)  i++;
                while (i < nums2.size() && nums2[j] == x) j++;
            }
            else if (nums1[i] < nums2[j]) {
                i++;
            }
            else {
                j++;
            }

        }
        return ret;
    }
};

class Solution
{
    bool hash[1010] = { 0 };
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2)
    {
        vector<int> ret;
        for (auto x : nums1)
        {
            hash[x] = true;
        }
        for (auto x : nums2)
        {
            if (hash[x])
            {
                ret.push_back(x);
                hash[x] = false;
            }
        }
        return ret;
    }
};



//https://www.nowcoder.com/practice/8d3643ec29654cf8908b5cf3a0479fd5?tpId=308&tqId=40462&ru=/exam/oj
#include <iostream>
#include <string>
#include <stack>
using namespace std;
string Delete(const string& str) {
    stack<char> stack;
    for (char c : str) {
        if (!stack.empty() && stack.top() == c) {
            stack.pop();
        }
        else {
            stack.push(c);
        }
    }
    if (stack.empty()) {
        string Ret;
        Ret = '0';
        return Ret;
    }
    string ret;
    while (!stack.empty()) {
        ret = stack.top() + ret;
        stack.pop();
    }

    return ret;
}

int main() {
    string str;
    cin >> str;
    cout << Delete(str) << endl;
}